package com.jungle.bfi.controller;
<#-- projectModule:main -->
<#assign projectModule = "main">

import com.jungle.base.dao.SpecBuilder;
import com.jungle.base.domain.bo.BaseUserBo;
import com.jungle.base.domain.vo.JsonResult;
import com.jungle.bfi.domain.bo.${model}Bo;
import com.jungle.bfi.entity.${model}Po;
import com.jungle.bfi.service.${module}.${model}Service;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import java.util.List;

/**
 * ${comment}
 * @author ${author}
 * @since ${since}
 */
@Slf4j
@RestController
@RequestMapping("${model?uncap_first}")
public class ${model}Controller {
    @Resource
    private ${model}Service ${model?uncap_first}Service;
    @PostMapping("store")
    public JsonResult<${model}Po> store(@RequestBody ${model}Bo qo) {
        ${model}Po po = ${model?uncap_first}Service.saveOrUpdate(qo, new BaseUserBo());
        return JsonResult.success(po);
    }

    @GetMapping("delete")
    public JsonResult<Void> delete(@RequestParam String id) {
        ${model?uncap_first}Service.deleteById(id);
        return JsonResult.success();
    }

    @PostMapping("list")
    public JsonResult<List<${model}Po>> list(@RequestBody ${model}Bo bo) {
        List<${model}Po> list = ${model?uncap_first}Service.findAll(new SpecBuilder<${model}Po>(bo).toSpec());
        return JsonResult.success(list);
    }
}
